# Contributor: psykose <alice@ayaya.dev>
# Maintainer: psykose <alice@ayaya.dev>
pkgname=plocate
pkgver=1.1.16
pkgrel=1
pkgdesc="posting-list based locate(1) for finding files"
url="https://plocate.sesse.net/"
arch="all"
license="GPL-2.0-or-later"
pkggroups="locate"
depends="!mlocate"
install="$pkgname.pre-install"
makedepends="
	liburing-dev
	linux-headers
	meson
	musl-legacy-error
	zstd-dev
	"
subpackages="$pkgname-doc"
source="https://plocate.sesse.net/download/plocate-$pkgver.tar.gz
	include-statx.patch
	plocate.cron
	updatedb.conf
	"
# no tests
# plocate is g+s
options="suid !check"

[ "$CARCH" = "riscv64" ] && options="$options textrels"

build() {
	abuild-meson \
		-Dlocategroup=locate \
		-Dinstall_cron=false \
		-Dinstall_systemd=false \
		. output
	meson compile -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
	install -Dm755 "$srcdir"/plocate.cron \
		"$pkgdir"/etc/periodic/daily/plocate
	install -Dm644 "$srcdir"/updatedb.conf \
		-t "$pkgdir"/etc
	chmod -R g+w "$pkgdir"/var/lib/plocate
	chgrp -R locate "$pkgdir"/var/lib/plocate
}

sha512sums="
01dfc3ba434e6164f3e582fb102bd7ec0167a8f93e4cf9c3e72af804a8eda9b69b04fec20ee34fc19549d810b97076342f3a83b46705d0311ada6004d05da26c  plocate-1.1.16.tar.gz
a88eb3cd4300256600aa245a67a71854220b9ffc89328e9f5664612092ca7d468c6729e823821b66109c75cebe046354503e5d6697de21c5086b26ffa4243edb  include-statx.patch
fdf72ed18ca06e65f929f88391012e5c5c95d50f411ea52be5915b54267b424d36fd27e0fdae6e8e439b63636dc951ae7d1a97fa812728f8a6c86db798a5004c  plocate.cron
863d8687bc1c520cc262ade3a7ce8a02b6930d7cbbc588c36d23f81a4a4c5432f4d9234a5498632b767a352e3996cf4da1c9e98d1b699b9d973cd9a9313d9557  updatedb.conf
"
